<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<link href="style/style.css" rel="stylesheet" type="text/css">
<link href="style/global.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="<%=basePath%>/js/global.js"></script>
<!--如用到jqueryBox必须引入 -->
<jsp:include page="/jqueryInclude.jsp" />
<script type="text/javascript">
var doAdd =function(){
var deptid=parent.document.getElementById('deptid').value;
var deptname=parent.document.getElementById('deptname').value;
window.location.href='addUser.do?action=before&dept.id='+(deptid==null?'':deptid)+'&dept.bmmc='+deptname;
}
function userExport(){	
	if(confirm("需要导出用户列表?")){
		var whereSql=document.getElementById("whereSql").value;
		window.open("system/excelOut.jsp?whereSql="+encodeURI(whereSql),"mainFrame");
	}	
}
</script>
<style>
body {
	background-color: white;
}
</style>
<table class="listTable" style="width: 100%;">
	<tr class="listTitle">
		<td width="6%">
			序号
		</td>
		<td width="25%">
			用户账号
		</td>
		<td width="25%">
			用户名称
		</td>
		<td width="25%">
			用户职务
		</td>
		<td width="19%">
			基本操作
		</td>
	</tr>
	<s:iterator id="user" value="%{list}" status="stuts">
		<tr class="listTr">
			<td>
				<s:property value="#stuts.count" />
			</td>
			<td>
				<s:property value="#user.ygzh" />
			</td>
			<td>
				<s:property value="#user.ygxm" />
			</td>
			<td>
				<s:property value="#user.ygzw" />
			</td>
			<td class="add">
				<s:if test="#session['userinfor'].isadmin==1||#session['userinfor'].rightcodes.contains('system.UserAction.userRole')">
					<a href="userRole.do?user.id=<s:property value="#user.id" />"><img src="images/flag/role.gif" alt="角色" /> </a>
				</s:if>
				<s:if test="#session['userinfor'].isadmin==1||#session['userinfor'].rightcodes.contains('system.UserAction.updateUser')">
					<a href="updateUser.do?action=before&user.id=<s:property value="#user.id" />&dept.id=<s:property value="#user.bmid" />"><img src="images/system/edit.gif" alt="修改" /> </a>
					<a href="javascript:if(confirm('您真的要重置该用户密码吗?点击确认进行重置！否则请点取消'))window.location='resetPwd.do?user.id=<s:property value="#user.id" />&dept.id=<s:property value="#user.bmid" />'"><img src="images/btn/rem-all.gif" alt="重置密码" /> </a>
				</s:if>
				<s:if test="#session['userinfor'].isadmin==1||#session['userinfor'].rightcodes.contains('system.UserAction.delUser')">
					<a href="javascript:if(confirm('您真的要删除吗?点击确认进行删除！否则请点取消'))window.location='delUser.do?user.id=<s:property value="#user.id" />&dept.id=<s:property value="#user.bmid" />'"><img src="images/system/delete.gif" alt="删除" /> </a>
				</s:if>
			</td>
		</tr>
	</s:iterator>
	<s:hidden name="whereSql" id="whereSql"></s:hidden>
</table>
<table width="92%" border="0" align="center" cellpadding="0" cellspacing="0">
	<tr>
		<td width="52%">
			<s:if test="#session['userinfor'].isadmin==1||#session['userinfor'].rightcodes.contains('system.UserAction.addUser')">
				<a href="javascript:doAdd()" class="search button01">添加</a>
			</s:if>
			<a onclick="jBox.open('div-jBoxID','div','search1','按条件查询','width=700,height=160,center=true,minimizable=true,resize=false,draggable=true,model=false');" href="javascript://" class="search button01">查询</a>

			<a href="javascript:userExport()" class="search button01">导出</a>
		</td>
		<td width="48%" align="right">
			<span style="text-align: center">${pageStr}</span>
		</td>
	</tr>
</table>
<div id="search1" style="display: none;">
	<form method="post" action="listUser.do">
		<table class="searchTable">
			<tr>
				<td valign="top">
					<table width="98%" border="0" align="center" cellpadding="1" cellspacing="1">
						<tr>
							<input type="hidden" name="query" value="1" />
							<input type="hidden" id="deptid" name="dept.id" value="${dept.id}">
							<td width="25%" align="right" height="30">
								用户名称：
							</td>
							<td width="20%" align="left">
								<input type="text" name="user.ygxm" title="姓名">
							</td>
							<td width="15%" align="right">
								用户账号：
							</td>
							<td width="50%" align="left">
								<input type="text" name="user.ygzh" title="账号">
							</td>
						</tr>
						<tr>
							<td width="30%" align="center" colspan="4">
								<input class="buttonSearch" id="button2" type="submit" value="搜索" />
								&nbsp;&nbsp;&nbsp;&nbsp;
								<input class="buttonSearch" id="button2" type="reset" value="重置" />
							</td>
						</tr>
					</table>
				</td>
			</tr>
		</table>
	</form>
</div>